package edu.qd.learn.newchapter.chapter03.relational.maytomany.service;

import edu.qd.learn.newchapter.chapter03.relational.maytomany.dao.ChooseCourseDao;

import java.util.Scanner;

/**
 * 学生选课系统 业务类
 *
 * @author 布衣
 */
public class StudentService {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        boolean t = true;
        ChooseCourseDao ccd = new ChooseCourseDao();
        while(t){
            System.out.println("先选择您的操作 A[选课] S【查看】 Q【退出】：");
            String type = s.next();
            switch (type){
                case "Q":
                   t=false;
                   break;
                case "A":
                    System.out.println("请输入您的学号：");
                    int sno = s.nextInt();
                    System.out.println("请输入您的姓名：");
                    String sname = s.next();
                    System.out.println("请输入课程编号：");
                    int cno = s.nextInt();
                    System.out.println("请输入课程名称：");
                    String cname = s.next();
                    System.out.println("请输入老师名称：");
                    String tname = s.next();
                    ccd.chooseCourse(sno, sname, cno, cname, tname);
                    break;
                case "S":
                    System.out.println(ccd.getCas());
                    break;
            }
        }
    }

}
